<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"/>
    <title>数据词典设置</title>
    <meta name="renderer" content="webkit"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta
            name="viewport"
            content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0"
    />
    <link rel="stylesheet" href="../js/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="../style/admin.css" media="all"/>
    <link rel="stylesheet" href="../style/home.css" media="all"/>
    <script src="../js/layui/layui.js"></script>
    <style>
        .layui-form-item .layui-inline {
            padding-right: 0px;
            margin-right: 0px;
        }
    </style>
</head>
<body layadmin-themealias="default">
<div class="" style="padding: 20px">
    <div class="layui-row layui-col-space15">
        <div class="layui-card pr20">
            <form class="layui-form" lay-filter="postData">
                <input type="hidden" name="classid" value="put" th:value="${dictInfo.classid}"/>
                <input type="hidden" name="id" value="put" th:value="${dictInfo.id}"/>
                <div class="layui-form-item">
                    <label class="layui-form-label">名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="name" placeholder="请输入名称"
                               autocomplete="off" class="layui-input" required
                               lay-verify="required" th:value="${dictInfo.name}"
                        />
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">值</label>
                        <div class="layui-input-inline" style="width: 155px">
                            <input type="tel" name="code" class="layui-input" required
                                   lay-verify="required" th:value="${dictInfo.code}">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">顺序号</label>
                        <div class="layui-input-inline" style="width: 155px">
                            <input type="text" name="idx" class="layui-input" th:value="${dictInfo.idx}">
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">描述</label>
                    <div class="layui-input-block">
                        <textarea name="remark" class="layui-textarea" th:text="${dictInfo.remark}"></textarea>
                    </div>
                </div>
                <button
                        type="submit"
                        class="layui-btn"
                        lay-submit=""
                        lay-filter="postData"
                        id="postBut"
                        style="display: none"
                >
                    立即提交
                </button>
            </form>
        </div>
    </div>
</div>
<script>
    var form = layui.form;
    var $ = layui.$;
    var callBackReturn = false,
        tree = layui.tree,
        OnPost = false;
    var index = parent.layer.getFrameIndex(window.name);

    form.on('submit(postData)', function (obj) {
        var data = obj.field;
        $.ajax({
            url: './saveDataDict', //url
            contentType: 'application/json',
            dataType: 'json', //数据格式
            type: 'POST', //请求方式
            async: false, //是否异步请求
            data: JSON.stringify(data),
            success: function (result) {
                if (result.code == 0) {
                    parent.layer.msg(result.message, {icon: 1});
                    callBackReturn = true;
                    OnPost = true;
                    parent.layer.close(index);
                } else {
                    OnPost = true;
                    parent.layer.alert(result.message, {icon: 2});
                }
            },
        });
        return false;
    });

    function Buttun_Submit() {
        document.getElementById('postBut').click();
        return callBackReturn;
    }
</script>
<script type="text/javascript" src="../js/lib/watermark.js"></script>
</body>
</html>